package cn.xie.blog.serviceuser.controller;

import cn.xie.blog.commonutil.response.Response;
import cn.xie.blog.serviceuser.service.FileOSSservice;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author: xiaoxie
 * create: 2025-04-23 10:43
 * @BelongsProject: blog-parent
 * @BelongsPackage: cn.xie.blog.serviceuser.controller
 * description: oss服务控制层
 */
@CrossOrigin //跨域
@RestController
@RequestMapping("/user/oss/")
public class FileOSSController {
    @Resource
    private FileOSSservice fileOSSservice;
    /**
     * @description: 文件上传
     * @author: xiaoxie
     * @date: 2025/4/23 上午10:46
     * @param: [file]
     * @return: cn.xie.blog.commonutil.response.Response<java.lang.String>
     **/
    @PostMapping("upload/")
    public Response<String> upload(@RequestPart("file") MultipartFile file) {
        return Response.ok(fileOSSservice.upload(file));
    }
}
